using System;
using System.Collections.Generic;
using System.Text;

namespace Mud.Server
{

    /// <summary>
    /// Abstract class for IServerObject which contains common functionality
    /// </summary>
    public abstract class ServerObject : IServerObject
    {
        #region IServerObject Members

        /// <summary>
        /// Gets the object id.
        /// </summary>
        /// <value>The object id.</value>
        public int ObjectId
        {
            get { return _objectId; }
        }
        private int _objectId;


		public IServer Server 
		{
			get { return _server; }
		}
		private IServer _server;


		public string Name {
			get { return _name; }
			set { _name = value; }
		}
		private string _name;


        #endregion

        /// <summary>
        /// Initializes a new instance of the <see cref="T:ServerObject"/> class.
        /// </summary>
        public ServerObject(IServer server)
        {
			if (server == null)
				throw new ArgumentNullException("server");
			_server = server;
			_objectId = _server.CurrentObjectIdManager.GetNextId();
        }

    }
}
